using System;
using System.IO;

namespace Pronghorn.Core
{
	public class StyleTag : FilesTagBase
	{
		public StyleTag(string code) : base(code)
		{
		}

		public StyleTag(Uri pathToFile) : base(pathToFile)
		{
		}

		protected override void RenderInlineTag(TextWriter writer)
		{
			if (_code.Length == 0) return;
			writer.WriteLine("<style>");
			writer.WriteLine(_code);
			writer.WriteLine("</style>");
		}

		protected override void RenderTagFromFile(TextWriter writer)
		{
			writer.WriteLine(string.Format("<link rel=\"stylesheet\" type=\"text/css\" href=\"{1}\" />",  _pathToFile));
		}
	}
}